home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
c
/
vbccm68k.lha
/
vbcc
/
machines
/
amiga68k
/
include
/
stdio.h
< prev
next >
Wrap
C/C++ Source or Header
|
1999-03-07
|
6KB
|
205 lines
/* Header fuer vbcc Amiga-Version */
/* stdio.h, teilweise angeregt aus K&R */
#ifndef __STDIO_H
#define __STDIO_H 1
#define EOF (-1)
#define BUFSIZ 1024L /* Groesse des Buffers */
#define FOPEN_MAX 1024 /* eigentlich auf Amiga beliebig */
#define _IOFBF 1L /* Volles Buffering */
#define _IOLBF 2L /* Zeilenbuffer */
#define _IONBF 3L /* kein Buffer */
#define HASBUF 1L /* hat einen Buffer */
#define NOBUFMEM 2L /* kein Buffer belegbar */
/* Returncodes von setvbuf */
#define SEEK_SET (-1) /* fseek relativ zu Dateibeginn */
#define SEEK_CUR 0 /* akt. Pos. */
#define SEEK_END 1 /* Dateiende */
#define _READ 1 /* Flags fuer FILE.flags, Lesen */
#define _WRITE 2
#define _UNBUF 4 /* ungepuffert */
#define _EOF 8 /* Fileende */
#define _ERR 16 /* Fehler */
#define _READABLE 32
#define _WRITEABLE 64
#define _LINEBUF 128
#define _NOTMYBUF 256
typedef struct _iobuf /* FILE-Struktur */
{
char *filehandle; /* AmigaDos-Filehandle */
char *pointer; /* Zeiger auf naechstes Zeichen */
char *base; /* Adresse des Buffers */
struct _iobuf *next; /* Zeiger auf naechste Struktur */
struct _iobuf *prev; /* tja, was wohl... */
int count; /* Anzahl Zeichen im Buffer */
int flags; /* Zugriffsmode */
int bufsize; /* Groesse des Buffers */
} FILE;
/* stdin/out/err muss von _main() initialisiert werden */
extern FILE *stdin, *stdout, *stderr;
int _fillbuf(FILE *),_putbuf(int,FILE *),_flushbuf(FILE *);
#define L_tmpnam 30
#define TMP_MAX FOPEN_MAX
#define FILENAME_MAX 107
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#ifndef __FPOS_T
#define __FPOS_T 1
typedef long fpos_t;
#endif
#ifndef __STDARG_H
#include <stdarg.h>
#endif
#undef NULL
#define NULL ((void*)0)
FILE *fopen(const char *,const char *);
FILE *freopen(const char *,const char *,FILE *);
int fflush(FILE *);
int fclose(FILE *);
int rename(const char *,const char *);
int remove(const char *);
FILE *tmpfile(void);
char *tmpnam(char *);
int setvbuf(FILE *,char *,int,size_t);
void setbuf(FILE *,char *);
int fprintf(FILE *, const char *, ...);
int printf(const char *, ...);
int sprintf(char *, const char *,...);
int __v0fprintf(FILE *, const char *);
int __v0printf(const char *);
int __v0sprintf(char *, const char *);
int vprintf(const char *,va_list);
int vfprintf(FILE *,const char *,va_list);
int vsprintf(char *,const char *,va_list);
int fscanf(FILE *, const char *, ...);
int scanf(const char *, ...);
int sscanf(const char *, const char *, ...);
int vscanf(const char *,va_list);
int vfscanf(FILE *,const char *,va_list);
int vsscanf(const char *,const char *,va_list);
char *fgets(char *, int, FILE *);
int fputs(const char *, FILE *);
char *gets(char *);
int puts(const char *);
int ungetc(int,FILE *);
size_t fread(void *,size_t,size_t,FILE *);
size_t fwrite(void *,size_t,size_t,FILE *);
int fseek(FILE *,long,int);
void rewind(FILE *);
long ftell(FILE *);
int fgetpos(FILE *,fpos_t *);
int fsetpos(FILE *,const fpos_t *);
void perror(const char *);
int fgetc(FILE *);
int fputc(int,FILE *);
int getchar(void);
int putchar(int);
#define __check(arg,type) sizeof((arg)==(type)0)
#define getc(p) (__check((p),FILE*),((p)->flags|=_READ),--((FILE*)(p))->count>=0?(unsigned char)*((FILE*)(p))->pointer++:_fillbuf(p))
#define __putc(x,p) (((p)->flags|=_WRITE),((--((FILE*)(p))->count>=0&&((x)!='\n'||!(((FILE*)(p))->flags&_LINEBUF)))?(unsigned char)(*((FILE*)(p))->pointer++=(x)):_putbuf((x),p)))
#define putc(x,f) fputc((x),(f))
#define getchar() getc(stdin)
#define putchar(x) putc((x),stdout)
/* einige der Makros muessen wohl durch echte Funktionen ersetzt werden */
#define feof(p) (__check((p),FILE*),((FILE*)(p))->flags&_EOF)
#define ferror(p) (__check((p),FILE*),((FILE*)(p))->flags&_ERR)
/*#define fileno(p) ((p)->filehandle) */ /* macht das Sinn? */
#define clearerr(p) (__check((p),FILE*),((FILE*)(p))->flags&=~(_ERR|_EOF))
#define fsetpos(f,ptr) fseek((f),*(ptr),SEEK_SET)
#pragma printflike printf
#pragma printflike fprintf
#pragma printflike sprintf
#pragma scanflike scanf
#pragma scanflike fscanf
#pragma scanflike sscanf
#ifdef __INLINE_ALL
#define __INLINE_FPUTC
#define __INLINE_FGETC
#define __INLINE_PUTS
#define __INLINE_GETS
#define __INLINE_FPUTS
#define __INLINE_FGETS
#define __INLINE_FPRINTF
#define __INLINE_PRINTF
#define __INLINE_SPRINTF
#endif
#ifdef __INLINE_PUTC
#pragma only-inline on
#include "vbcc:libsrc/stdio/putc.c"
#pragma only-inline off
#endif
#ifdef __INLINE_FPUTC
#pragma only-inline on
#include "vbcc:libsrc/stdio/fputc.c"
#pragma only-inline off
#endif
#ifdef __INLINE_FGETC
#pragma only-inline on
#include "vbcc:libsrc/stdio/fgetc.c"
#pragma only-inline off
#endif
#ifdef __INLINE_FPUTS
#pragma only-inline on
#include "vbcc:libsrc/stdio/fputs.c"
#pragma only-inline off
#endif
#ifdef __INLINE_FGETS
#pragma only-inline on
#include "vbcc:libsrc/stdio/fgets.c"
#pragma only-inline off
#endif
#ifdef __INLINE_PUTS
#pragma only-inline on
#include "vbcc:libsrc/stdio/puts.c"
#pragma only-inline off
#endif
#ifdef __INLINE_GETS
#pragma only-inline on
#include "vbcc:libsrc/stdio/gets.c"
#pragma only-inline off
#endif
#ifdef __INLINE_FPRINTF
#pragma only-inline on
#include "vbcc:libsrc/stdio/__v0fprintf.c"
#pragma only-inline off
#endif
#ifdef __INLINE_PRINTF
#pragma only-inline on
#include "vbcc:libsrc/stdio/__v0printf.c"
#pragma only-inline off
#endif
#ifdef __INLINE_SPRINTF
#pragma only-inline on
#include "vbcc:libsrc/stdio/__v0sprintf.c"
#pragma only-inline off
#endif
#endif